Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

207
Vistas
Chrome doesn't fire "onerror" event for "link" tag?

I am updating the theming system for a website, and I am trying to handle when a <link rel="stylesheet"> element fails to load a theme so that I can have it fallback to a default theme (as well as to identify outdated theme selections, etc.).

In Firefox, I can use the "onerror" event through jQuery before setting the href attribute, e.g. $("#myLinkElement").one("error", handleThemeLoadError).attr("href", themeUrl).

If themeUrl refers to a CSS file that does not exist (resulting in a 404), the handleThemeLoadError is called.

In Chrome, however, the onerror event is never fired. I see the 404 error in the console and network tabs, and Chrome even shows me the line of code where the attribute is set that caused the 404 error, but it will not fire an error event. I have even tried $("#myLinkElement").get(0).onerror = function() { ... }, and I've also tried setting the href attribute to both null and undefined before setting it to the actual URL.

Is there some other way to catch stylesheet load errors in Chrome, or am I completely out of luck?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda